package rg.edu.ap.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import rg.edu.ap.dao.SeatDao;
import rg.edu.ap.po.Seat;
import rg.edu.ap.service.SeatService;

@Service
public class SeatServiceImpl implements SeatService{
    
	@Autowired
	private SeatDao seatdao;
	
	public void addSeat(int bathid, int merid, int seatnum,int seatsex,int seatflag,int seatprice) {
		int a=seatnum;
		for(int si=1;si<=a;si++) {
			seatdao.addSeat(bathid,merid,si,seatsex,seatflag,seatprice);
		}
	}
	
	public List makeSeat(Seat seat) {
		return seatdao.makeSeat(seat);
	}
	
	public void delSeat(Seat seat) {
		seatdao.delSeat(seat);
	}
	
	public void updateUserSeat(int bathid, int merid, int userid, int usercost,  ArrayList<Integer> sn) {
		for(int i = 0;i<sn.size();i++) {
			int a=sn.get(i);
			System.out.println(a);
			int seatflag=1;
			seatdao.updateUserSeat(bathid,merid,userid,usercost,seatflag,a);
		}
	}
	
	public List findOrderSeat(int userid) {
		return seatdao.findOrderSeat(userid);
	}
}
